package com.example.springboot.mapper;

import com.example.springboot.domain.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component(value ="userMapper")
public interface UserMapper {

    @Update("update user set username=#{username},password=#{password},email=#{email},phone=#{phone},avatar=#{avatar} where userid=#{userid} ")
    public void updateUser(User user);

    @Select("select * from user where username = #{username}")
    public User selectByUsername(String username);

    @Insert("insert into user (username,password,email,phone,avatar) values (#{username},#{password},#{email},#{phone},#{avatar})")
    public void insert(User user);

    @Select("select * from user where userid = #{userid}")
    public User selectById(Integer userid);

}
